#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: node01_js.py 
@version:
@time: 2022/05/18 
"""
from TapClientCore.T04_logic.Dag02.node.operate_node.node08_field_rename import FieldRenameNode


class JS(FieldRenameNode):

    def generate_node(self, operations):
        if not operations:
            operations = """function process(record){\n\n\t// Enter you code at here\n\treturn record;\n}"""
        node = {
            "id": self.newId,
            "name": "自动化-JavaScript-共享缓存",
            "processorThreadNum": 1,
            "catalog": "processor",
            "elementType": "Node",
            "type": "js_processor",
            "attrs": {
                "position": [
                    -500,
                    200
                ]
            },
            "script": operations
        }
        self.node = node
